<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./bootstrap/css/bootstrap.min.css" />
    <script src="./bootstrap/js/bootstrap.min.js"></script>

    <link rel="stylesheet" href="./fontawesome/css/all.min.css" />
    <script src="./fontawesome/js/all.min.js"></script>
  </head>
  <body>
    <div id="app">
      <h1>封装组件</h1>

      <button @click="visible=true">ADD</button>
      <bs-dialog title="添加" :visible="visible" @confirm="yes" @cancel="no">
        <div class="mb-3">
          <label class="form-label">
            <bs-icon name="user"></bs-icon>用户名</label
          >
          <input type="text" class="form-control" />
        </div>
      </bs-dialog>
    </div>
    <script type="module">
      import { createApp, ref } from "./vue.esm-browser.js";
      /* 属性 事件 插槽 */
      import BsButton from "./components/BsButton.js";
      import BsDialog from "./components/BsDialog.js";
      import BsIcon from "./components/BsIcon.js";

      const app = createApp({
        setup() {
          const visible = ref(false);
          function yes() {
            visible.value = false;
            console.log("yes");
          }
          function no() {
            visible.value = false;
            console.log("no");
          }
          return { yes, no, visible };
        },
      });

      app.component("BsButton", BsButton);
      app.component("BsDialog", BsDialog);
      app.component("BsIcon", BsIcon);
      app.mount("#app");
    </script>
  </body>
</html>
